#include <stdio.h>
#include <string.h>

char* str2num(char* a, int *num) //start point, return num;
{
	int t=0,tmp[10],p=1,if_minus=0;
	char *k=a;
	while (*k<'0'||*k>'9')
	{
		if(*k=='\0') return k;
		k++;
	}
	//if(*(k-1)=='-') if_minus=1;
	while (*k>='0' && *k<='9') tmp[t++]=*(k++)-'0';
	t=t-1;
	*num=0;
	while(t>=0)
	{
		*num+=tmp[t]*p;
		t--;
		p*=10;
	}
	//if(if_minus==1) *num=-*num;
	return k; //return final point
}

int getline(char* dstStr)
{
	char c;
	int k=0;
	scanf("%c",&c);
	while(c!='\n') 
	{
		*dstStr++ = c;
		k++;
		scanf("%c",&c);
	}
	*dstStr = '\0';
	return k;
}

void trim(char* strIn, char* strOut) // support in-place opreation
{
	char *a=strIn, *b;
	while (*a == ' '||*a == '\n' ) a++; // ignore spaces at the beginning
	b = strIn + strlen(strIn) - 1; // get pointer pointing at the end of the line
	while (*b == ' '||*b == '\n' ) b--; // ignore spaces at the end
	while (a<=b) *strOut++ = *a++; // transplace
	*strOut='\0';
}

int main()
{
    char buffer[256];

    char opes[128]={0};
    float nums[128]={0};
    int n_index=0,o_index=0;

    getline(buffer);
    trim(buffer,buffer);
    char *p = buffer;

    while(*p!='\0')
    {
        int t;
        p = str2num(p,&t);
        nums[n_index++] = t;
        if(o_index>0) if ( opes[o_index-1] == '*' || opes[o_index-1] == '/' )
        {
            //if ((o_index - 1 )>0 && (n_index-1)>1 )
            if(opes[o_index-1]=='*') {
                printf("%f * %f = ",nums[n_index - 2],nums[n_index - 1]);
                nums[n_index - 2] *= nums [n_index - 1];
                printf("%f\n",nums[n_index - 2]);
            }
            if(opes[o_index-1]=='/') {
                printf("%f / %f = ",nums[n_index - 2],nums[n_index - 1]);
                nums[n_index - 2] /= nums [n_index - 1];
                printf("%f\n",nums[n_index - 2]);
            }
            n_index--;
            o_index--;
        }
        while (*p == ' ') p++;
        if (*p == '\0') break;
        opes[o_index++]=*p++;
        //while(*p==' ') p++;
    }
    int i=0,j=0;
    while (j<o_index)
    {
        if(opes[j] == '+' ) 
        {
            printf("%f + %f = ",nums[i],nums[i+1]);
            nums[i+1] += nums [i];
            printf("%f\n",nums[i+1]);
        }
            
        if(opes[j] == '-' )
        {
            printf("%f - %f = ",nums[i],nums[i+1]);
            nums[i+1] = nums [i] - nums[i+1];
            printf("%f\n",nums[i+1]);
        }
        i++;
        j++;
    }
    printf("%f \n",nums[n_index-1]);
    return 0;
}
